home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / ABUSESRC.ZIP / AbuseSrc / abuse / src / status.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-11  |  1.2 KB  |  67 lines

  1. #include "macs.hpp"
  2. #include "status.hpp"
  3. #include "dprint.hpp"
  4.  
  5. class status_node;
  6.  
  7. class StatusManager
  8. {
  9.   status_node *first;
  10.   StatusManager() { first=NULL; }
  11.   virtual void push(char *name, visual_object *show);
  12.   virtual void update(int percentage);
  13.   virtual void pop();
  14. } ;
  15.  
  16. extern StatusManager *stat_man;
  17.  
  18.  
  19.  
  20. StatusManager *stat_man=NULL;
  21.  
  22. class status_node
  23. {
  24.   public :
  25.   char *name;
  26.   status_node *next;
  27.   visual_object *show;
  28.   time_marker last_update;
  29.   status_node(char *Name, visual_object *Show, status_node *Next) 
  30.   { name=strcpy((char *)jmalloc(strlen(Name)+1,"status name"),Name); 
  31.     show=Show;
  32.     next=Next; 
  33.   }
  34.   ~status_node() { jfree(name); if (show) delete show; }
  35. }
  36.  
  37.  
  38.  
  39.  
  40. void StatusManager::push(char *name, visual_object *show)
  41. {
  42.   first=new status_node(name,show,first);  
  43. }
  44.  
  45. void StatusManager::update(int percentage)
  46. {
  47.   dprintf("\r%s [\n");
  48.   int t=percentage/5;
  49.   for (int i=0;i<t;i++)
  50.     dprintf(".");
  51.   for (i=t+1;i<20;i++)
  52.     dprintf(" ");
  53.   dprintf("]");
  54. }
  55.  
  56. void StatusManager::pop()
  57. {
  58.   CONDITION(first,"No status's to pop!");
  59.   status_node *p=first; first=first->next;
  60.   delete p;
  61. }
  62.  
  63.  
  64.  
  65.  
  66.  
  67.